<?php

class Adresa extends BaseAdresa
{
	public function __toString()
	{
	  return "{$this->getGmap()}";
	}
	
	public function getObject()
	{
	  return $c = $this->getClient() ? $c : $f = $this->getFurnizor() ? $f : $this->getUser();
	}
	
	public function getGMapView()
	{
    $g = new GMap();
    if (!($geocoded = $g->geocode($adresa = $this->getGmap()))) return null;
    //marker cu adresa
    $gMarker = new GMapMarker($geocoded->getLat(),$geocoded->getLng(), array('title'=>'"'.$adresa.'"'));
    $gMarker->addHtmlInfoWindow(new GMapInfoWindow("<b>Adresa:</b><br />$adresa<br /><br /><b>Mentiuni:</b><br />{$this->getDetalii()}"));
    $g->addMarker($gMarker);
    $g->centerAndZoomOnMarkers(0.3);
    return $g;
	}
}
sfPropelBehavior::add('Adresa', array('sfPropelActAsSignableBehavior' => array()));